<!--
  @author nowind
  @since 17/07/23 14:34
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<title>新增或编辑产品</title>
</head>
<style>
    .layui-card .layui-form .layui-form-label {
        width: 130px;
    }
</style>
<body>
<div class="layui-fluid">
    <blockquote class="layui-crumb">
        <zmn th:text="订单配置 ">订单配置</zmn>&nbsp;&nbsp;/&nbsp;
        <a lay-href="/orderconfig/cancelReason/list.action">取消缘由</a>&nbsp;&nbsp;/&nbsp;
        <zmn>[[${reason.reason}]]</zmn>
    </blockquote>

    <div class="layui-card">

        <div class="layui-card-body">

            <form method="post" action="" class="layui-form" lay-filter="zmn-form">

                <input type="hidden" name="id" th:value="${reason.id}"/>

                <div class="layui-card-header" style="margin-top:10px;"><b>基本信息</b></div>

                <div class="layui-form-item" th:if="${reason.id > 0}">
                    <label class="layui-form-label">ID：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid">
                            <span th:text="${reason.id}">ID</span>
                            <span th:text="${reason.status == 2 ? '启用' : '禁用'}">status</span>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">取消分类：</label>
                    <div class="layui-input-inline">
                        <select name="categId" id="categId" lay-filter="categId"  lay-verify="required">
                            <option value="">请选择</option>
                            <option th:value="${item.categId}"
                                    th:text="${item.name}"
                                    th:selected="${item.categId == reason.categId}"
                                    th:each="item:${cancelCategorys}">
                            </option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">二级取消缘由：</label>
                    <div class="layui-input-inline" style="width: 390px">
                        <input type="text" name="reason" th:value="${reason.reason}" placeholder="100字以内"
                               lay-verify="required" autocomplete="off" class="layui-input" maxlength="100"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">一级取消缘由：</label>
                    <div class="layui-input-inline" style="width: 390px">
                        <input type="text" name="levelOneReason" th:value="${reason.levelOneReason}" placeholder="100字以内"
                               lay-verify="required" autocomplete="off" class="layui-input" maxlength="100"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">解释说明：</label>
                    <div class="layui-input-inline" style="width: 500px">
                    <textarea placeholder="500字以内" maxlength="500" th:text="${reason.remark}" id="remark" name="remark"
                              class="layui-textarea"></textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">取消节点：</label>
                    <div class="layui-input-inline" style="width: 500px">
                        <zmn th:each="item:${cancelNodeList}">
                            <input type="checkbox" name="node" lay-filter="node" th:title="${item.value}"
                                   th:value="${item.key}" lay-skin="primary" th:checked="${reason.node != null && reason.node.indexOf(item.key+'')!=-1}">
                        </zmn>

                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">发起人：</label>
                    <div class="layui-input-inline" style="width: 500px">
                        <zmn th:each="item:${cancelTypeList}">
                            <input type="checkbox" name="type" lay-filter="type" th:title="${item.value}"
                                   th:value="${item.key}" lay-skin="primary" th:checked="${reason.type != null && reason.type.indexOf(item.key+'') != -1}">
                        </zmn>

                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">生成投诉：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="complaint" value="2" title="是" th:checked="${reason.complaint == 2}">
                        <input type="radio" name="complaint" value="1" title="否"
                               th:checked="${reason.complaint == 1 || reason.id == null }">
                        <span style="color: #999;">勾选生成投诉，表示勾选了该取消缘由的订单，在取消后自动生成一条投诉记录</span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">生成异常：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="abnormal" value="2" title="是" th:checked="${reason.abnormal == 2}">
                        <input type="radio" name="abnormal" value="1" title="否"
                               th:checked="${reason.abnormal == 1 || reason.id == null }">
                        <span style="color: #999;">勾选生成异常，表示勾选了该取消缘由的订单，在取消后自动生成一条异常</span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">是否通知工程师：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="noticeEngineer" value="2" title="是" th:checked="${reason.noticeEngineer == 2}">
                        <input type="radio" name="noticeEngineer" value="1" title="否"
                               th:checked="${reason.noticeEngineer == 1 || reason.id == null }">
                        <span style="color: #999;">勾选后将在订单取消后通过app消息通知工程师</span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">是否通知用户：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="noticeUser" value="2" title="是" th:checked="${reason.noticeUser == 2}">
                        <input type="radio" name="noticeUser" value="1" title="否"
                               th:checked="${reason.noticeUser == 1 || reason.id == null }">
                        <span style="color: #999;">勾选后将在订单取消后通过短信消息通知用户</span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">业务类型：</label>
                    <div class="layui-input-block">
                        <zmn th:each="item:${bizTypeList}">
                            <input type="checkbox" name="bizType" th:value="${item.key}" th:title="${item.value}"
                                   th:checked="${reason.bizType != null && reason.bizType.indexOf(item.key+'') != -1}">
                        </zmn>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">排序：</label>
                    <div class="layui-input-inline">
                        <input type="number" name="sort" autocomplete="off" class="layui-input" th:value="${reason.sort}"
                               lay-verify="isPositiveNumber"  onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')">
                    </div>
                    <span class="layui-form-mid" style="color: #999;">数字越小，排越前面</span>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">状态：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="1" title="停用"
                               th:checked="${reason.status == 1 || reason.id == null }">
                        <input type="radio" name="status" value="2" title="启用" th:checked="${reason.status == 2}">
                    </div>
                </div>

                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit"
                                th:if="${#authPermit.checkPermit('/orderconfig/cancelReason/detail.action')}">保存
                        </button>
                        <button class="layui-btn layui-btn-primary"
                                onclick="parent.layui.element.tabDelete('layadmin-layout-tabs', window.location.pathname + window.location.search)">取消
                        </button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
</body>
</html>
<script type="text/javascript" th:inline="javascript">
    layui.config({
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
        cancel_reason_detail_js: "orderconfig/cancel/reason/zmn.plat.orderconfig.cancel.reason.detail",
    }).use(['index', 'cancel_reason_detail_js']);
</script>
